<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .da {
            height: 400px;
            display: flex;
        }

        .zuo {
            position: relative;
        }

        .zuo img {
            width: 400px;
            height: 400px;
        }

        .zuo .mc {
            pointer-events: none;
            width: 200px;
            height: 200px;
            background-color: rgba(0, 0, 0, 0.35);
            position: absolute;
            top: 0;
            left: 0;
            display: none;
        }

        .zo {
            width: 70px;
            height: 400px;
            margin-left: 10px;
        }

        li {
            list-style: none;
            margin-bottom: 8.5px;
        }

        li img {
            width: 70px;
            height: 70px;
        }

        .r {
            width: 400px;
            height: 400px;
            background-image: url(./images/1.jpg);
            margin-left: 10px;
            display: none;
        }
    </style>
</head>

<body>
    <div class="da">
        <div class="zuo">
            <img src="./images/1.jpg" alt="">
            <div class="mc">

            </div>
        </div>
        <div class="zo">
            <ul>
                <li><img src="./images/1.jpg"></li>
                <li><img src="./images/2.jpg"></li>
                <li><img src="./images/3.jpg"></li>
                <li><img src="./images/4.jpg"></li>
                <li><img src="./images/5.jpg"></li>
            </ul>
        </div>
        <div class="r">

        </div>
    </div>
</body>

</html>
<script>
    var zotu = document.querySelectorAll('li img')
    var zuotu = document.querySelector('.zuo img')
    var mc = document.querySelector('.mc')
    var r = document.querySelector('.r')
    //点击事件-排他
    for (i = 0; i < zotu.length; i++) {
        zotu[i].onclick = function () {
            for (i = 0; i < zotu.length; i++) {
                zotu[i].style.border = ''
            }
            zuotu.src = this.src
            this.style.border = '2px solid blue'
        }
        //滑过滑出
        zotu[i].onmouseover = function () {
            this.style.border = '2px solid yellow'
            // zuotu.src=this.src
        }
        zotu[i].onmouseout = function () {
            this.style.border = ''
        }
    }
    //蒙层显示与隐藏
    zuotu.onmouseenter = function () {
        mc.style.display = 'block'
        r.style.display = 'block'
    }
    zuotu.onmouseleave = function () {
        mc.style.display = 'none'
        r.style.display = 'none'
    }
    //蒙层移动，跟随
    zuotu.onmousemove = function (e) {
        var x=e.pageX - 100;
        var y=e.pageY - 100;
        x= x<0?0:x
        y= y<0?0:y
        x=x>200?200:x
        y=y>200?200:y
        mc.style.left = x + 'px'
        mc.style.top = y + 'px'
        r.style.backgroundImage= `url(${this.src})`
        r.style.backgroundPosition= `${-2*x}px ${-2*y}px`
    }
</script>